from langchain_core.prompts import ChatPromptTemplate
from langchain_ollama import ChatOllama

from common_config import CHAT_OLLAMA_MODEL

llm = ChatOllama(model=CHAT_OLLAMA_MODEL, temperature=0.1)

template = """
接下来，我想你提问，你需要将问题分解成多个STEP，将每一步放在<step-?>...</step-?>之间输出，?表示第几步。

{message}

/nothink
"""

prompt = ChatPromptTemplate.from_template(template)

chat = prompt | llm

for chuck in chat.stream({"message": "如何制作提拉米苏?"}):
    print(chuck.content, end="", flush=True)

